<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>{ms:global.name/}</title>  
    <link rel="stylesheet" href="{ms:globalskin.url/}/css/gui.css">
    <link rel="stylesheet" href="{ms:globalskin.url/}/css/login-reg.css">
    <link rel="stylesheet" href="{ms:globalskin.url/}/css/list.css">
    <link rel="stylesheet" href="{ms:globalskin.url/}/css/index.css" >
    <script src="{ms:globalskin.url/}/js/jquery-1.9.1.min.js" type="text/javascript" ></script>    
    <script src="{ms:globalskin.url/}/js/jquery.cookie.js" type="text/javascript"></script>   
    <script src="{ms:globalskin.url/}/js/jquery.cookies.2.2.0.js" type="text/javascript"></script> 
    <script src="http://static.ming-soft.net/base/ms.base.min.js"></script> 
    <script src="http://static.ming-soft.net/util/ms.util.min.js"></script>
    <script src="http://static.ming-soft.net/people/ms.people.min.js" type="text/javascript"></script> 
</head>
<body>
  {ms:include filename=head.htm/} 
  <div class="wrap grow gmt30 gpack" style="min-height:376px;margin-top:30px;width:960px;">
        <div class="gspan-6 gprefix-3 gsuffix-3 side" style="width:350px">
           <img width="350" style="margin-top:10px" src="{ms:globalskin.url/}/images/password.jpg"/>
        </div>
        <div class="gspan-15 gprefix-4 main" style="width:545px">                
            <h1>修改密码</h1>
            <form class="gform" id="regForm" method="POST">
                <p class="gform-box">
                  <input class="gbtxt" id="pass" maxlength="20" name="passWord" placeholder="当前密码" required type="text" value="">
                </p>
                <p class="gform-box">
                  <input class="gbtxt" id="pass1"  maxlength="20" name="newPassWord" placeholder="请新输入密码" required type="password" value="">
                </p>
                <p class="gform-box">
                  <input class="gbtxt" id="pass2" maxlength="20" name="confirmPassWord" placeholder="确认新密码" required type="password" value="">
                </p>
                <p class="gform-box">
                  <button type="button" class="gform-submit greg-btn">立即修改</button>
                </p>
            </form>
        </div>
    </div>
    {ms:include filename=foot.htm/} 
</body>
</html>  
<script>
  //获取当前密码输入框
  var pass = $("#pass");
  //获取新密码输入框
  var pass1 = $("#pass1");
  //获取确认密码输入框
  var pass2 = $("#pass2");
  $(".greg-btn").click(function(){
    $("span").remove();
    if(pass.val().length == 0 ){
            pass.after("<span class='tip'>当前密码不能为空</span>");
            return false;
    }else if(pass1.val().length <6  || pass1.val().length >20){
            pass1.after("<span  class='tip'>新密码长度不正确</span>");
            return false;
    }else if(pass1.val() != pass2.val() ){
            pass2.after("<span  class='tip'>两次密码不一致</span>");
            return false;
    }else{
        ms.people.changePassWord($("#regForm").serialize(),{"func":function(json){//调用方法          
           if(json.result == false){
              pass.after("<span class='tip'>"+json.resultMsg+"</span>");              
           }else{
              alert("修改密码成功");
              exit();
              alert("请重新登录");
           }
      }})
  }})
</script>
<script>
  function exit() {
  ms.people.quit({"func":function(json){
        $.cookies.del('PEOPLE_COOKIE');
        location.href = "{ms:global.url/}/index.html";
  }});
}
</script>